#!/usr/bin/python3
# -*- coding: utf-8 -*-


import requests # 发送http请求
from bs4 import BeautifulSoup # 解析html
import lxml # 解析器 中文不乱码

# 1.获取html内容 1499 2016
start_url = "http://image.baidu.com/search/index?tn=baiduimage&ct=201326592&lm=-1&cl=2&ie=gb18030&word=ͼƬ&fr=ala&ala=1&alatpl=others&pos=0"

headers = {
	'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.26 Safari/537.36 Core/1.63.6788.400 QQBrowser/10.3.2864.400',
	'Referer':''
}

response = requests.get(url=start_url, headers=headers)
print(response.text)

# 2.解析html内容
soup = BeautifulSoup(response.content, "html.parser")
# print(soup)
# 查找标签
tab = soup.find_all(lambda tag:tag.has_attr('data-objurl')) # 找到所有 有data-objurl 属性 的标签)
print(tab)